function twitterCallback(data) {
if (data.length <= 0) return;
var last = data[0];
var now = new Date()
var cutoff = new Date(now.getDate() - 3);
var day = new Date(last.created_at);
var diff = (now.getTime() - day.getTime())/1000;
var posted = '';
if(day < cutoff) { return }
var html = last.text.toString();
// auto link urls
var reURLs = /((http|https|ftp):\/\/[\w?=&.\/-;#~%-]+(?![\w\s?&.\/;#~%"=-]*>))/g;
html = html.replace(reURLs, '<a href="$1">$1</a> ')
// auto link twitter @ msgs
var reTwitter = /\@([a-z0-9]*)/g
html = html.replace(reTwitter, '<a href="http://www.twitter.com/$1">@$1</a> ')
$('#twitter').addClass('enabled');
$('#twitter-update').html(html);
if (diff < 300) {
	posted = 'moments ago';
} else if (diff < 1800) { // under 30 mins
	posted = 'a couple minutes ago';
} else if (diff < 3600) { // under 1 hour
	posted = 'a few minutes ago';
} else if (diff < 86400) { // 24 hours
	posted = 'a couple hours ago';
} else {
	posted = 'a few days ago';
}
$('#twitter-date').html('posted '+posted);
}

document.write('<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/joetan.json?callback=twitterCallback"></script>');